<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="username">
    <input type="text" id="password">
    <input type="button" value="login" onclick="doLogin()">
    <script>
        function doLogin(){
            let username=document.getElementById("username").value;
            let password=document.getElementById("password").value;
            let xhr=new XMLHttpRequest();
            xhr.open("get",`/login?username=${username}&password=${password}`);
            xhr.onload=function(){
                let res=JSON.parse(xhr.responseText);
                if(res.flag){
                    location.href="/10.list.html";
                }else{
                    alert("该用户不存在");
                }
            };
            xhr.send();
        }
    </script>
</body>
</html>